os.loadAPI("api/json")

function load(name)
	if fs.exists('/etc/'..name..'.conf') then
		local f = fs.open('/etc/'..name..'.conf', 'r')
		data = json.decode(f.readAll())
		f.close()
		return data
	else
		return {}
	end
end

function save(name, cfg)
	if not fs.exists('/etc') then
		fs.makeDir('/etc')
	end
	local f = fs.open('/etc/'..name..'.conf', 'w')
	f.write(json.encode(cfg))
	f.close()
end